%% Carbon Taxes Around the World: Cooperation, Strategic Interactions, and Spillovers
% IMF Economic Review
% Alessandro Moro and Valerio Nispi Landi
% Replication files
% This file finds the optimal tax in the small model

function [ F ]  = find_opt_tax(x,gamma,gamma1,gamma2,phi,ni,nu,zeta,tauz,UT,D_lf)
Ei=x(1);
Ez=x(2);

if UT==0
D=1-exp(-gamma*phi*(ni*Ei+(1-ni)*Ez));
Yi=(1-D)*Ei^(nu);
Yz=(1-D)*Ez^(nu);

F=[Ei-nu/(zeta+gamma*phi*ni*Yi)*Yi 
   Ez-nu/(zeta+tauz)*Yz 
];

else
Yi=(1-D_lf)*Ei^(nu);
Yz=(1-D_lf)*Ez^(nu);

F=[Ei-nu/(zeta+(Yi-zeta*Ei)*phi*ni*(gamma1+gamma2*(ni*Ei+(1-ni)*Ez)))*Yi 
   Ez-nu/(zeta+tauz)*Yz 
];


end


end